/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "AULA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Aula.findAll", query = "SELECT a FROM Aula a"),
    @NamedQuery(name = "Aula.findByAulCod", query = "SELECT a FROM Aula a WHERE a.aulCod = :aulCod"),
    @NamedQuery(name = "Aula.findByAulCap", query = "SELECT a FROM Aula a WHERE a.aulCap = :aulCap"),
    @NamedQuery(name = "Aula.findByAulDes", query = "SELECT a FROM Aula a WHERE a.aulDes = :aulDes"),
    @NamedQuery(name = "Aula.findByLocCod", query = "SELECT a FROM Aula a WHERE a.locCod = :locCod")})
public class Aula implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "AUL_COD")
    private Integer aulCod;
    @Basic(optional = false)
    @Column(name = "AUL_CAP")
    private int aulCap;
    @Column(name = "AUL_DES")
    private String aulDes;
    @Column(name = "LOC_COD")
    private String locCod;
    @OneToMany(mappedBy = "aulCod", fetch = FetchType.LAZY)
    private List<ModuloGrupo> moduloGrupoList;
    @OneToMany(mappedBy = "aulCod", fetch = FetchType.LAZY)
    private List<Horario> horarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "aula", fetch = FetchType.LAZY)
    private List<ModuloCalendario> moduloCalendarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "aula", fetch = FetchType.LAZY)
    private List<AulaOcupada> aulaOcupadaList;

    public Aula() {
    }

    public Aula(Integer aulCod) {
        this.aulCod = aulCod;
    }

    public Aula(Integer aulCod, int aulCap) {
        this.aulCod = aulCod;
        this.aulCap = aulCap;
    }

    public Integer getAulCod() {
        return aulCod;
    }

    public void setAulCod(Integer aulCod) {
        this.aulCod = aulCod;
    }

    public int getAulCap() {
        return aulCap;
    }

    public void setAulCap(int aulCap) {
        this.aulCap = aulCap;
    }

    public String getAulDes() {
        return aulDes;
    }

    public void setAulDes(String aulDes) {
        this.aulDes = aulDes;
    }

    public String getLocCod() {
        return locCod;
    }

    public void setLocCod(String locCod) {
        this.locCod = locCod;
    }

    @XmlTransient
    public List<ModuloGrupo> getModuloGrupoList() {
        return moduloGrupoList;
    }

    public void setModuloGrupoList(List<ModuloGrupo> moduloGrupoList) {
        this.moduloGrupoList = moduloGrupoList;
    }

    @XmlTransient
    public List<Horario> getHorarioList() {
        return horarioList;
    }

    public void setHorarioList(List<Horario> horarioList) {
        this.horarioList = horarioList;
    }

    @XmlTransient
    public List<ModuloCalendario> getModuloCalendarioList() {
        return moduloCalendarioList;
    }

    public void setModuloCalendarioList(List<ModuloCalendario> moduloCalendarioList) {
        this.moduloCalendarioList = moduloCalendarioList;
    }

    @XmlTransient
    public List<AulaOcupada> getAulaOcupadaList() {
        return aulaOcupadaList;
    }

    public void setAulaOcupadaList(List<AulaOcupada> aulaOcupadaList) {
        this.aulaOcupadaList = aulaOcupadaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (aulCod != null ? aulCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aula)) {
            return false;
        }
        Aula other = (Aula) object;
        if ((this.aulCod == null && other.aulCod != null) || (this.aulCod != null && !this.aulCod.equals(other.aulCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //TODO: renderers
        return aulCod+"";
        //return "pe.edu.unmsm.cinfo.siga.datos.Aula[ aulCod=" + aulCod + " ]";
    }
    
}
